package com.ipan.weixin.msg.general;

import org.apache.http.entity.ContentType;
import org.dom4j.Document;

import com.ipan.weixin.WxConfiguration;

/**
 * 接收/回复 普通消息
 * 
 * 普通消息均以XML格式传输.
 * 
 * @author iPan
 * @version 2013-12-23
 */
public interface XmlMsg {
	
	/** ContentType */
	public static final ContentType CONTENT_TYPE = ContentType.create("text/xml", WxConfiguration.getInstance().getEncode());
	
	/**
	 * 传输类型
	 */
	public enum TransportType {
		RECEIVE, REPLY, RECEIVE_AND_REPLY
	}

	// -- 消息元素-- //
	public static final String EL_MSG_ID = "MsgId";

	public static final String EL_MSG_TYPE = "MsgType";

	public static final String EL_CREATE_TIME = "CreateTime";

	public static final String EL_FROM_USER_NAME = "FromUserName";

	public static final String EL_TO_USER_NAME = "ToUserName";

	public static final String EL_CONTENT = "Content";

	public static final String EL_MEDIA_ID = "MediaId";

	public static final String EL_PIC_URL = "PicUrl";

	public static final String EL_RECOGNITION = "Recognition";

	public static final String EL_FORMAT = "Format";

	public static final String EL_DESCRIPTION = "Description";

	public static final String EL_TITLE = "Title";

	public static final String EL_THUMB_MEDIA_ID = "ThumbMediaId";

	public static final String EL_LABEL = "Label";

	public static final String EL_SCALE = "Scale";

	public static final String EL_LOCATION_Y = "Location_Y";

	public static final String EL_LOCATION_X = "Location_X";

	public static final String EL_URL = "Url";

	public static final String EL_HQ_MUSIC_URL = "HQMusicUrl";
	
	public static final String EL_MUSIC_URL = "MusicUrl";
	
	public static final String EL_ARTICLE_COUNT = "ArticleCount";
	
	public static final String EL_IMAGE = "Image";
	
	public static final String EL_VOICE = "Voice";
	
	public static final String EL_VIDEO = "Video";
	
	public static final String EL_MUSIC = "Music";
	
	public static final String EL_EVENT_KEY = "EventKey";

	public static final String EL_EVENT = "Event";
	
	public static final String EL_PRECISION = "Precision";

	public static final String EL_LONGITUDE = "Longitude";

	public static final String EL_LATITUDE = "Latitude";
	
	public static final String EL_TICKET = "Ticket";
	
	public static final String EL_ARTICLES = "Articles";

	public static final String EL_ITEM = "item";

	// -- 消息类型 -- //
	public static final String TYPE_TEXT = "text";
	
	public static final String TYPE_IMAGE = "image";
	
	public static final String TYPE_VOICE = "voice";
	
	public static final String TYPE_VIDEO = "video";
	
	public static final String TYPE_LOCATION = "location";
	
	public static final String TYPE_LINK = "link";
	
	public static final String TYPE_MUSIC = "music";
	
	public static final String TYPE_NEWS = "news";
	
	public static final String TYPE_EVENT = "event";
	
	// -- 事件消息具体事件类型 -- //
	public static final String EVENT_SUBSCRIBE = "subscribe";
	
	public static final String EVENT_UNSUBSCRIBE = "unsubscribe";
	
	public static final String EVENT_SCAN = "scan";
	
	public static final String EVENT_LOCATION = "LOCATION";
	
	public static final String EVENT_CLICK = "CLICK";
	
	// -- 消息处理 -- //
	public void fromXml(Document doc);
	
	public String toXml(boolean nonEmpty);
	
	public String toXml();
	
	// -- 传输类型 -- //
	public TransportType getTransportType();

}
